﻿<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="Alerts.aspx.cs" Inherits="Alerts" %>
<%@ Register Src="~/AlertsCategoryList.ascx" TagPrefix="uc" TagName="AlertsCategoryList" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
  <style>
/* 主容器样式 */
.table-container, .threshold-container {
    padding: 20px;
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0px 4px 10px rgba(0, 0, 0, 0.1);
    max-width: 750px;
    margin: 20px auto;
    font-family: 'Arial', sans-serif;
}

/* 表格样式 */
table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
}

table th, table td {
    padding: 14px 20px;
    text-align: left;
    font-size: 16px;
}

table th {
    background: linear-gradient(90deg, #ff7043, #f4511e);
    color: white;
    font-weight: bold;
    font-size: 16px;
}

table td {
    border-bottom: 1px solid #e0e0e0;
    color: #333;
}

table tr:hover td {
    background-color: #f9f9f9;
}

/* 输入框样式 */
input[type="text"] {
    width: 90%;
    padding: 8px 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 14px;
    background-color: #f9f9f9;
    transition: border 0.3s;
}

input[type="text"]:focus {
    border: 1px solid #ff7043;
    outline: none;
    background-color: #fff;
}

/* 按钮样式 */
button, .button {
    background-color: #ff7043;
    color: white;
    border: none;
    border-radius: 6px;
    padding: 10px 20px;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.3s ease, transform 0.2s ease;
    margin: 20px auto;
    display: block;
}

button:hover, .button:hover {
    background-color: #d84315;
    transform: scale(1.05);
}

/* 自定义弹窗 */
.custom-modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
}

.custom-modal-content {
    position: relative;
    margin: 10% auto;
    padding: 20px;
    width: 300px;
    background: linear-gradient(135deg, #ffecb3, #ffcc80);
    border-radius: 10px;
    text-align: center;
    box-shadow: 0px 4px 15px rgba(0, 0, 0, 0.2);
}

.custom-modal .close {
    position: absolute;
    top: 10px;
    right: 10px;
    font-size: 20px;
    color: #333;
    cursor: pointer;
}

.custom-modal p {
    font-size: 16px;
    color: #333;
}

.custom-modal button {
    background-color: #ff7043;
    color: white;
    border: none;
    padding: 8px 15px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: bold;
    transition: background-color 0.3s ease, transform 0.2s ease;
}

.custom-modal button:hover {
    background-color: #d84315;
    transform: scale(1.05);
}
</style>

</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
    <uc:AlertsCategoryList ID="AlertsCategoryListControl" runat="server" />
</asp:Content>

<asp:Content ID="Content3" ContentPlaceHolderID="ContentPlaceHolder2" Runat="Server">
   <div class="threshold-container">
        <h2 style="color: #f4511e; text-align: center;">阈值设置</h2>
       <asp:GridView ID="gvThresholdSettings" runat="server" AutoGenerateColumns="false" DataKeyNames="指标id">
    <Columns>
        
        <asp:BoundField DataField="指标名称" HeaderText="指标名称" />
        
        
        <asp:TemplateField HeaderText="健康阈值">
            <ItemTemplate>
                <asp:TextBox ID="txtThreshold" runat="server" Text='<%# Eval("健康阈值") %>' />
            </ItemTemplate>
        </asp:TemplateField>

       
       <asp:TemplateField HeaderText="通知阈值条件">
    <ItemTemplate>
       <asp:DropDownList ID="ddlTriggerCondition" runat="server" 
    SelectedValue='<%# Eval("通知阈值条件") != null && (Eval("通知阈值条件").ToString() == "high" || Eval("通知阈值条件").ToString() == "low") ? Eval("通知阈值条件") : "high" %>'>
    <asp:ListItem Text="高于" Value="high" />
    <asp:ListItem Text="低于" Value="low" />
</asp:DropDownList>

    </ItemTemplate>
</asp:TemplateField>

<asp:TemplateField HeaderText="通知方式">
    <ItemTemplate>
        <asp:CheckBoxList ID="cbNotificationMethod" runat="server">
            <asp:ListItem Text="短信" Value="sms" />
            <asp:ListItem Text="邮件" Value="email" />
            <asp:ListItem Text="系统通知" Value="system" />
        </asp:CheckBoxList>
    </ItemTemplate>
</asp:TemplateField>

    </Columns>
</asp:GridView>

<asp:Button ID="btnSaveThresholds" runat="server" Text="保存阈值" OnClick="btnSaveThresholds_Click" CssClass="button" />


    </div>

    <!-- 自定义弹窗 -->
    <div id="customModal" class="custom-modal">
        <div class="custom-modal-content">
            <span class="close" onclick="closeModal()">&times;</span>
            <p>阈值已更新</p>
            <button onclick="closeModal()">确定</button>
        </div>
    </div>

    <script>
        function showModal() {
            document.getElementById("customModal").style.display = "block";
        }

        function closeModal() {
            document.getElementById("customModal").style.display = "none";
        }
    </script>
</asp:Content>
